# Kleene logic, defined in mvl-toolkit by Koen Lefever 2009-2010, GPL v.3 licensed

from Logic import *

class K3(Logic):
    """Kleene logic"""
    def __init__(self, truth_values_list = ['F', 'U', 'T'], designated_values_list = ['T']):
        if not len(truth_values_list) == 3:
            raise ValueError('K3 is a ternary logic, please provide three truth values.')
        if not len(designated_values_list) == 1:
            raise ValueError('Please provide exactly one designated value for K3.')
        Logic.__init__(self, truth_values_list, designated_values_list)

    def AND(self, P, Q):
        return self.operator(113, P, Q)

    def OR(self, P, Q):
        return self.operator(4049, P, Q)

    def IF_THEN(self, P, Q):
        return self.operator(19337, P, Q)

    def NOT(self, P):
        return self.operator(19305, P, P)
